package com.itheima.mappr;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserMapper {
//    @Select("select * from user")
    public List<User> findAll();

//    @Insert("insert into user(id, username, password, name, age) VALUES (null,#{username}, #{password}, #{name}, #{age} )")
    public int save(User user);

//    @Delete("delete from user where id = #{id}")
    public int deleteById(Integer id);

//    @Update("update user set username=#{username}, password=#{password}, name=#{name}, age=#{age} where id=#{id} ")
    public int update(User user);

//    @Select("select * from user where username=#{username} and password=#{password}")
    public int selectUsernameAndPassword(@Param("username") String username, @Param("password") String password);

//    @Select("select * from ${tableName} order by ${columnName}")
    public List<Map> findobjectlist(@Param("tableName") String tableName,@Param("columnName") String columnName);
}
